/* Theme Variables */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-primary: #3b82f6;
    --border-color: #e2e8f0;
    --chat-bg: #ffffff;
    --message-bg: #f1f5f9;
    --user-message-bg: #eff6ff;
}

:root[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --accent-primary: #60a5fa;
    --border-color: #334155;
    --chat-bg: #1e293b;
    --message-bg: #334155;
    --user-message-bg: #1e3a8a;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease;
    font-family: Arial, sans-serif; 
    margin: 20px; 
    line-height: 1.6;
}

.chat-container {
    max-width: 1600px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.document-select-card {
    background: var(--chat-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.select-input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.chat-interface {
    background: var(--chat-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.initial-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--message-bg);
}

.user-message {
    background: var(--user-message-bg);
    align-self: flex-end;
}

.message-form {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
}

.message-input {
    flex-grow: 1;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: none;
    min-height: 20px;
    max-height: 150px;
}

.send-button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.send-button:hover {
    opacity: 0.9;
}

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.theme-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .chat-container {
        margin: 1rem;
    }
    
    .message {
        max-width: 90%;
    }
}